<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib uri="http://workflowReviewTag.weitu.net" prefix="flow" %><!--工作流审批处理标签-->
<!doctype html>
<html lang="zh">
<head>
    <title>审批请假单</title>
    <%@include file="/common/header.jspf"%>
    <style>
        .flow_review{

            width:100%;
            margin-bottom:20px;
        }
        .flow_review .review_title{
            width:100px;
            text-align: right;
        }
        .flow_review>table{
            width:100%;
        }
        .flow_review label{
            float:left;
            width:50px;
        }
        .flow_review label>input{
            width:10px;
        }
        .flow_review textarea{
            width:80%;
        }
        .flow_review .review_next_check{
            width:100%;
        }
        /*.flow_review .review_result{
            padding-left:20%;
            height:30px;
            line-height:30px;
        }
        .flow_review .review_result>label{
            width:50px;
            float:left;
        }
        .flow_review .review_result>label>input{
            width:10px;
        }
        .flow_review  .review_comments{
            height:auto;
        }
        .flow_review  .review_comments>textarea{
            margin-left:10%;
            width:80%;
        }*/
    </style>
</head>
<body>
<div class="form-wrap">
    <form id="leaveForm" method="post">
        <input type="hidden" name="workItemId" value="${workItemId}" />
        <div class="input-wrap">
            <label class="label-top">请假类型:</label>
            <select name="type" style="width: 300px;height:30px;" readonly="true">
                <c:if test="${leaveApplication.type==0}">
                    <option value="0">事假</option>
                </c:if>
                <c:if test="${leaveApplication.type==1}">
                    <option value="1">婚假</option>
                </c:if>
            </select>
        </div>
        <div class="input-wrap">
            <label class="label-top tip_code">开始时间:</label>
            <input class="easyui-textbox " name="startDate" data-options="required:true,validType:'checkCode'" style="width: 300px;" title="" readonly value="${leaveApplication.startDate}"/>
        </div>
        <div class="input-wrap">
            <label class="label-top">结束时间:</label>
            <input class="easyui-textbox "  name="endDate" data-options="required:true" style="width: 300px;" title="" readonly value="${leaveApplication.endDate}"/>
        </div>
        <div class="input-wrap">
            <label class="label-top">请假天数:</label>
            <input class="easyui-numberspinner "  name="leaveDay" value="0" style="width: 360px;" title="" readonly value="${leaveApplication.leaveDay}"/>
        </div>
        <div class="input-wrap">
            <label class="label-top">请假内容:</label>
            <input class="easyui-textbox " name="content" data-options="prompt:'填写备注',multiline:true"  style="height:60px;width: 360px;" readonly title="" value="${leaveApplication.content}"/>
        </div>
        <c:if test="${formType==1}">
            <div class="input-wrap">
                <!--工作流审批意见-->
                <flow:review requestName="workflowReview" workItemId="${workItemId}"/>
            </div>
        </c:if>
    </form>
    <div class="form-button">
        <c:if test="${formType==1}">
            <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="fa fa-save fa-lg" id="leaveSave" >保存</a>
        </c:if>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        /***
         * 审批操作
         */
        $('#leaveSave').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data=$("#leaveForm").serializeJson();
            if(!checkVerifyResult('workflowReview')){
                $.messager.progress('close');
                return false;
            }
            //表单提交
            $('#leaveForm').form('submit', {
                url: ROOT_PATH + '/workflow/demo/verifyLeaveApplication.shtml',
                data:data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    }catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                    if (result.success){
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message,{time:1000,icon:1},function () {
                            WindowManager.closeLayer();//关闭窗口
                        });
                    }else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message,{time:1000,icon:2});
                    }
                }
            });
        });


    });

</script>
</body>
</html>
